package com.ruoyi.web.controller.restaurant;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.restaurant.domain.RestDish;
import com.ruoyi.restaurant.domain.dto.DailyRevenueDTO;
import com.ruoyi.restaurant.domain.dto.DishProcurementVolumeDTO;
import com.ruoyi.restaurant.domain.dto.DishRankingDTO;
import com.ruoyi.restaurant.service.IRestDishService;
import com.ruoyi.restaurant.service.IStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/restaurant/statistics")
public class RestStatisticsController {

    @Autowired
    private IStatisticsService iStatisticsService;

    @Autowired
    private IRestDishService iRestDishService;

    /**
     * 查询每日收入统计
     */
    @GetMapping("/dailyRevenue")
    public AjaxResult getDailyRevenue() {
        List<DailyRevenueDTO> revenueList = iStatisticsService.getDailyRevenue();
        return AjaxResult.success(revenueList);
    }

    /**
     * 查询采购量统计（按菜品统计）
     */
    @GetMapping("/procurementVolume")
    public AjaxResult getProcurementVolume() {
        List<DishProcurementVolumeDTO> procurementList = iStatisticsService.getProcurementVolume();
        return AjaxResult.success(procurementList);
    }

    /**
     * 查询菜品订单排名
     */
    @GetMapping("/dishRanking")
    public AjaxResult getDishOrderRanking() {
        List<DishRankingDTO> rankingList = iStatisticsService.getDishOrderRanking();
        return AjaxResult.success(rankingList);
    }

    /**
     * 查询菜品库存
     */
    @GetMapping("/dishStock")
    public AjaxResult getDishOrderRanking(RestDish restDish) {
        List<RestDish> list = iRestDishService.selectRestDishList(restDish);
        return AjaxResult.success(list);
    }
}
